<%-- 
    Document   : login_post
    Created on : Dec 6, 2011, 9:43:56 PM
    Author     : THIENSUHACK
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@page import="GetData.DataWS"%>
<%@page import="dktc_ws.Sinhvien"%>
<%@page import="java.util.LinkedList"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@page import="java.util.Calendar"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="GetData.DataWS"%>
<%@page import="DTO.sinhvien"%>

<%  
 String username=""; 
 String password=""; 
 
 dktc_ws.Sinhvien sv=new Sinhvien();
 
DataWS data=new DataWS();
 if(request.getParameter("uname")!=null && request.getParameter("password")!=null)
         {
             username= request.getParameter("uname");   
         password= request.getParameter("password"); 
             sv=data.laymotsinhvien(username);  
                    String masv=sv.getMasv().trim();
                   sv.setMasv(masv); 
                    //out.print(masv+sv.getMatkhau());
          if (username.equals(sv.getMasv()))
          { 
              if(password.equals(sv.getMatkhau()))
              {  
                session.setAttribute("uid",sv.getMasv()); 
               session.setAttribute("uname",sv.getHoten()); 
               session.setAttribute("birthday",sv.getNgaysinh()); 
               session.setAttribute("email",sv.getEmail());    
               response.sendRedirect("/DKTC/frontend/index.jsp?page=index.jsp"); 
              } 
              else{ 
               /*sai password*/ 
               //response.sendRedirect("/DKTC/frontend/index.jsp?page=index.jsp"); 
                 // out.print("ko khớp pass");
               } 
         } 
         else{ 
          /*sai user*/ 
          //response.sendRedirect("/DKTC/frontend/index.jsp?page=index.jsp"); 
         //out.print("ko tồn tại sinh viên này2");
         }        
      }
else
       {
   // out.print("chua dien du thong tin");
    
}
%> 
 <script>
    window.location="/DKTC/frontend/index.jsp";
</script>